﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using StockholmsStad.Runtime.Serialization.DataContract;
using StockholmsStad.Runtime.Serialization.DataContract.Enums;
using StockholmsStad.Utilities.Exceptions;

namespace StockholmsStad.ServiceModel.Interfaces
{
    /// <summary>
    /// Servicekontrakt för windows klient tjänsterna
    /// </summary>
    [ServiceContract]
    public interface ITempService
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<CeremonySummary> GetIndividualCeremonyBookingForDate(User user, DateTime dateTime);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <param name="ministerId"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<CeremonySummary> GetIndividualCeremonyBooking(User user, DateTime fromDate, DateTime? toDate, int? ministerId);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<CeremonySummaryDetails> GetIndividualCeremonyBookingDetails(User user, DateTime dateTime);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<CeremonySummary> GetOrdinaryCeremonyBookingForDate(User user, DateTime dateTime);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <param name="ministerId"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<CeremonySummary> GetOrdinaryCeremonyBooking(User user, DateTime fromDate, DateTime? toDate, int? ministerId);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<CeremonySummaryDetails> GetOrdinaryCeremonyBookingDetails(User user, DateTime dateTime);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        DateTime GetNextCeremonyDateForIndividualService(User user);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        DateTime GetNextCeremonyDateForOrdinaryService(User user);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        DateTime GetPreviousCeremonyDateForIndividualService(User user);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        DateTime GetPreviousCeremonyDateForOrdinaryService(User user);

        /// <summary>
        /// Hämtar övrig information för ett ärende. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="ticketId">Ärende-numret för den ceremoniinformation som ska hämtas</param>
        /// <returns>Informationen för ett visst ärende (<see cref="TicketInformation"/>). </returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        TicketInformation GetTicketInformation(User user, int ticketId);

        /// <summary>
        /// Lägger till övrig information till ett ärende. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="ticketInformation">Den information som ska läggas till (<see cref="TicketInformation"/>).</param>
        /// <returns>Id-värdet på den tillagda informationen. </returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        int AddTicketInformation(User user, TicketInformation ticketInformation);

        /// <summary>
        /// Uppdaterar övrig information för ett visst ärende. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="ticketInformation">Den information som ska uppdateras. </param>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        void UpdateTicketInformation(User user, TicketInformation ticketInformation);

        /// <summary>
        /// Hämtar lediga tillgängliga språk för en viss typ av certifikat. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="certificateType">Anger vilken typ som tillgängliga språk finns för. </param>
        /// <returns>En lista med språk (<see cref="ValueIdPair"/>).</returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<ValueIdPair> GetAvailableLanguagesForReportDefinition(User user, MarriageCertificateType certificateType);

        /// <summary>
        /// Hämtar alla tillgängliga språk för en viss typ av certifikat. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="certificateType">Anger vilken typ som tillgängliga språk finns för. </param>
        /// <returns>En lista med språk (<see cref="ValueIdPair"/>).</returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<ValueIdPair> GetLanguagesForCertificateType(User user, MarriageCertificateType certificateType);

        /// <summary>
        /// Skapar en ny rapportdefinition (en rapport med nytt språk och innehåll). 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="certificate">Innehållet på den nya rapportdefinitionen. </param>
        /// <returns>Id-numret på den tillagda rapportdefinitionen. </returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        int AddNewMarriageCertificate(User user, MarriageCertificate certificate);

        /// <summary>
        /// Uppdaterar en befintlig rapportdefinition. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="certificate">Innehållet på den nya rapportdefinitionen. </param>
        /// <returns>Id-numret på den tillagda rapportdefinitionen. </returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        void UpdateMarriageCertificate(User user, MarriageCertificate certificate);

        /// <summary>
        /// Hämtar ett registreringsbevis. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="marriageCertificateType">Id-numret på det aktuella beviset. </param>
        /// <param name="languageId">Id-numret på det aktuella beviset. </param>
        /// <returns>Registreringsbeviset. </returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        MarriageCertificate GetMarriageCertificate(User user, MarriageCertificateType marriageCertificateType, int languageId);

        /// <summary>
        /// Hämtar befintliga affärsregler
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <returns>De regler som gäller. </returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        ParVisProperties GetProperties(User user);

        /// <summary>
        /// Uppdaterar affärsregler. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="properties">De regler som ska uppdateras. </param>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        void SetProperties(User user, ParVisProperties properties);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<ValueIdPair> GetLanguages(User user);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="languageName"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        int AddLanguage(User user, string languageName);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        int AddSpecialNeed(User user, string name);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        int AddCeremonyLanguage(User user, string name);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        int AddCertificateLanguage(User user, string name);

        /// <summary>
        /// Hämtar alla texter av en viss typ. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="textTypeId">Id-värdet på den texttyp som ska hämtas. </param>
        /// <returns>En lista med texter. </returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        IList<InformationText> GetTexts(User user, int textTypeId);

        /// <summary>
        /// Hämtar alla typer av texter som finns
        /// </summary>
        /// <param name="user"></param>
        /// <returns>En lista med tillgängliga texttyper</returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        IList<ValueIdPair> GetTextTypes(User user);

        /// <summary>
        /// Hämtar en viss text. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="textId">Id-värdet på den text som ska hämtas. </param>
        /// <returns>En lista med texter. </returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        InformationText GetText(User user, int textId);

        /// <summary>
        /// Lägger till text. 
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="text">Den text som ska läggas till (<see cref="InformationText"/>). </param>
        /// <returns>Nyckeln på den tillagda texten. </returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        int AddText(User user, InformationText text);

        /// <summary>
        /// Updaterar text.
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="text">Den text som ska uppdateras (<see cref="InformationText"/>). </param>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        void UpdateText(User user, InformationText text);

        /// <summary>
        /// Ta bort text.
        /// </summary>
        /// <param name="user">Den inloggade användaren (<see cref="User"/>).</param>
        /// <param name="text">Den text som ska tas bort (<see cref="InformationText"/>). </param>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        void DeleteText(User user, InformationText text);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="partOfName"></param>
        /// <param name="assignmentStartDate"></param>
        /// <param name="assignmentEndDate"></param>
        /// <param name="isActive"></param>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(StockholmStadApplicationErrorFault))]
        [FaultContract(typeof(StockholmStadSystemErrorFault))]
        List<Minister> GetMinisters(User user, string partOfName, DateTime? assignmentStartDate,
                                    DateTime? assignmentEndDate, bool isActive);

    }
}